//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
/* md5.h - Declaration of functions and data types used for MD5 sum
   computing library functions.
   Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
   NOTE: The canonical source of this file is maintained with the GNU C
   Library.  Bugs can be reported to bug-glibc@prep.ai.mit.edu.

   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2, or (at your option) any
   later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

#ifndef _MD5_H
#define _MD5_H 1

#if defined HAVE_LIMITS_H || _LIBC
//# include <limits.h>
#endif

//#include <types.h>
//#include <sys/types.h>

typedef unsigned int u_int32_t;
typedef u_int32_t md5_uint32;

/* Structure to save state of computation between the single steps.  */
struct md5_ctx
{
    md5_uint32 A;
    md5_uint32 B;
    md5_uint32 C;
    md5_uint32 D;

    md5_uint32 total[2];
    md5_uint32 buflen;
    char buffer[128];
};

void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx);
void md5_process_bytes(const void *buffer, size_t len, struct md5_ctx *ctx);

#define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )

#endif
